package com.atwisdom.star.controller;

import com.alibaba.fastjson.JSONObject;
import com.atwisdom.star.common.vo.ActionData;
import com.atwisdom.star.common.vo.JsonResult;
import com.atwisdom.star.common.vo.ResultInfo;
import com.atwisdom.star.core.bsl.functionClass.DatabaseBslService;
import com.atwisdom.star.core.bsl.functionClass.impl.DatabaseBslServiceImpl;
import com.atwisdom.star.core.dao.pojo.functionClass.DatabaseBackup;
import com.atwisdom.star.exception.pojo.BusinessException;
import com.atwisdom.star.log.aop.StarAnnotation;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@AllArgsConstructor
@RestController
@RequestMapping("/database")
public class DatabaseController {
    private DatabaseBslServiceImpl databaseBslService;

    /**
     *
     * @param actionDataList 接收参数据
     * @return 返回结果
     * @throws BusinessException  业务异常
     */
    @SneakyThrows
    @StarAnnotation
    @PostMapping
    public ResultInfo<?> responseHelpFactory(@RequestBody List<ActionData<JSONObject>> actionDataList) throws BusinessException {
        return databaseBslService.responseFactory(actionDataList);
    }
}
